00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _graph_partitioner_hpp_
00020 #define _graph_partitioner_hpp_
00021
00022 #include <boost/scoped_ptr.hpp>
00023 #include <gridpack/partition/graph_partitioner_implementation.hpp>
00024
00025 namespace gridpack {
00026 namespace network {
00027
00028
00029
00030
00031
00032 class GraphPartitioner
00033 : public parallel::WrappedDistributed,
00034 private utility::Uncopyable
00035 {
00036 public:
00037
00038 typedef GraphPartitionerImplementation::Index Index;
00039 typedef GraphPartitionerImplementation::IndexVector IndexVector;
00040 typedef GraphPartitionerImplementation::MultiIndexVector MultiIndexVector;
00041
00042
00043 GraphPartitioner(const parallel::Communicator& comm);
00044
00045
00046 GraphPartitioner(const parallel::Communicator& comm,
00047 const int& local_nodes, const int& local_edges);
00048
00049
00050 ~GraphPartitioner(void);
00051
00052
00053 void add_node(const Index& global_index, const Index& original_index)
00054 {
00055 p_impl->add_node(global_index, original_index);
00056 }
00057
00058
00059
00060 void add_edge(const Index& edge_index,
00061 const Index& node_index_1,
00062 const Index& node_index_2)
00063 {
00064 p_impl->add_edge(edge_index, node_index_1, node_index_2);
00065 }
00066
00067
00068 void get_global_edge_ids(int idx, Index *node_index_1, Index *node_index_2) const
00069 {
00070 p_impl->get_global_edge_ids(idx, node_index_1, node_index_2);
00071 }
00072
00073
00074 size_t nodes(void) const
00075 {
00076 return p_impl->nodes();
00077 }
00078
00079
00080 Index node_index(const int& local_index) const
00081 {
00082 return p_impl->node_index(local_index);
00083 }
00084
00085
00086 size_t edges(void) const
00087 {
00088 return p_impl->edges();
00089 }
00090
00091
00092 Index edge_index(const int& local_index) const
00093 {
00094 return p_impl->edge_index(local_index);
00095 }
00096
00097
00098 void partition(void)
00099 {
00100 p_impl->partition();
00101 }
00102
00103
00104 void node_destinations(IndexVector& dest) const
00105 {
00106 p_impl->node_destinations(dest);
00107 }
00108
00109
00110 void edge_destinations(IndexVector& dest) const
00111 {
00112 p_impl->edge_destinations(dest);
00113 }
00114
00115
00116 void ghost_node_destinations(MultiIndexVector& dest) const
00117 {
00118 p_impl->ghost_node_destinations(dest);
00119 }
00120
00121
00122 void ghost_edge_destinations(IndexVector& dest) const
00123 {
00124 p_impl->ghost_edge_destinations(dest);
00125 }
00126
00127 protected:
00128
00129
00130 boost::scoped_ptr<GraphPartitionerImplementation> p_impl;
00131
00132 };
00133
00134
00135 }
00136 }
00137
00138
00139 #endif